#include<iostream>
#include<vector>
using namespace std;
typedef struct pos
{
	int x1;
	int y1;
	int x2;
	int y2;
};
int main()
{
	int n, k;
	cin >> n >> k;
	pos* arr = new pos[n];
	vector<int> it;
	int i = 0;
	for (i; i < n; i++)
	{
		cin >> arr[i].x1 >> arr[i].y1 >> arr[i].x2 >> arr[i].y2;
		it.push_back(i);
	}
	while (k--)
	{
		int x, y,flag=0;
		cin >> x >> y;
		for (i = n-1; i>=0 ; i--)
		{
			int m = it[i];
			if (x >= arr[m].x1 && x <= arr[m].x2 && y >= arr[m].y1 && y <= arr[m].y2)
			{
				cout << m + 1 << endl;
				it.erase(it.begin()+i);
				it.push_back(m);
				flag = 1;
				break;
			}
		}
		if (flag == 0)
			cout << "IGNORED" << endl;
	}
}